<template>
  <!-- 操作提示弹窗 operationTipsDialog -->
  <Dialog
      ref="operationTips"
      dialogCls="mydlgg"
      headerCls="mydlgg-head"
      footerCls="mydlgg-foot"
      :dialogStyle="{ width: '450px' }"
      :modal="true"
      borderType="thin"
      @close="close"
    >
      <div slot="header">
        <span class="headerIcon tipsMsg"></span>
        <span class="titleStyle">操作提示信息</span>
      </div>

      <!-- insidePadding这个div必须保留 -->
      <div class="insidePadding">
        <div style="padding:0 20px 0px 20px;">
          <p style="text-align:left;color: red;" v-if="message != ''">
            <!-- 确认要取消请假吗？取消后将不可再变更状态！ -->
            {{message}}
          </p>
          <p style="text-align:left;color: red;" v-else>
            确认要{{acType}}吗？
          </p>
          <div>
                <Label><span style="color:red">*</span>{{acType}}原因:</Label>
                <TextBox :multiline="true" v-model="description"  style="width:100%;height:50px"
                         :placeholder="placeholder"></TextBox>
            </div>
        </div>
      </div>

      <div slot="footer" style="border:none">
        <div class="footerDiv">
          <!-- footer、footerDiv这两个div必须保留 -->
          <LinkButton @click="submit" class="saveBtn">确定</LinkButton>
          <LinkButton @click="close" class="cancelBtn">返回</LinkButton>
        </div>
      </div>
    </Dialog>
</template>

<script>

export default {
  props: {
    message: String,     //展示信息
    acType:{
      type:String,
      default:'取消'
    },
    save: Function     //保存方法
  },
  components: {},
  name: "",
  data() {
    return {
      description: "",
      placeholder:""
    };
  },
  mounted() {
    this.$refs.operationTips.close();
    this.placeholder = "请填写"+this.acType+"原因（必填）";
  },
  methods: {
    // 打开弹窗
    open() {
      this.$refs.operationTips.open();
    },
    // 关闭弹窗
    close() {
      this.description = "";
      this.$refs.operationTips.close();
    },
 
    // 提交--调用父级页面传的保存方法
    submit() {
      // 如果取消原因为空，请输入取消原因
      if (this.description == "") {
        this.$messager.alert({
          title: "系统提示",
          icon: "info",
          msg: this.acType +"原因不能为空"
        });
        return;
      }
      this.save()
    },
  }
};
</script>

<style scoped></style>
